<?php
	include_once("DataProvider.php");
	include_once("../DTO/donDatHangDTO.php");
	
	class donDatHangDAO
	{
		public $sql = "";
		var $donDatHangDTO;
		function __construct()
		{
			return $this->donDatHangDTO = new donDatHangDTO();
		}
		
		public function load()
		{
			$result= DataProvider::ExecuteQuery($this->sql);
			$arrDonDatHangDTO = new ArrayObject();
			
			while($row = mysql_fetch_array($result))
			{
				$donDatHangDTO = new donDatHangDTO();
				$donDatHangDTO->idDonDatHang = $row['idDonDatHang'];
				$donDatHangDTO->idTaiKhoan = $row['idTaiKhoan'];
				$donDatHangDTO->ngay = $row['ngay'];
				$donDatHangDTO->tongThanhTien = $row['tongThanhTien'];
				
				$arrDonDatHangDTO[] = $donDatHangDTO;
			}
			return $arrDonDatHangDTO;
		}
		
		public function load_All()
		{
			$this->sql= 'select * from dondathang';
			$result=$this->load();
			return $result; 
		}
		
		public function load_One($idDonDatHang)
		{
			$this->sql = 'select * from dondathang where idDonDatHang ='.$idDonDatHang;
			$result = $this->load();
			return $result;
		}
		
	}
	
?>